import request from '@/utils/request'

export function login(username, password) {
  return request({
    url: '/admin/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}


export function logout() {
  return request({
    url: '/admin/logout',
    method: 'post'
  })
}


/**
 * 添加用户
 * @param data
 * @returns
 */
export function adminAdd(data) {
  return request({
    url: '/manageApi/v1/adminAdd',
    method: 'post',
    data: data
  })
}
/**
 * 列表
 * @returns
 */
export function adminList(data) {
  return request({
    url: '/manageApi/v1/adminList',
    method: 'post',
    data:data
  })
}
/**
 * 修改状态
 * @param data
 * @returns
 */
export function adminAjax(data) {
  return request({
    url: '/manageApi/v1/adminAjax/'+ data,
    method: 'PUT',
  })
}
/**
 * 查询
 * @returns
 */
export function adminInfo(id) {
  return request({
    url: '/manageApi/v1/adminInfo/' + id,
    method: 'get',
  })
}
/**
 * 修改
 * @param data
 * @returns
 */
export function adminEdit(data) {
  return request({
    url: '/manageApi/v1/adminEdit',
    method: 'PUT',
    data: data
  })
}
/**
 * 删除
 * @param id
 * @returns
 */
export function adminDel(id) {
  return request({
    url: '/manageApi/v1/adminDel/' + id,
    method: 'DELETE'
  })
}
/**
 *  单独分配角色
 * @param data
 * @returns
 */
export function adminAuthEdit(data) {
  return request({
    url: '/manageApi/v1/adminAuthEdit',
    method: 'PUT',
    data: data
  })
}
